import { ref, onMounted, onUnmounted } from "vue";

import { storeToRefs } from 'pinia'
import { useIsCollapseStore } from "@/stores/iscollapse";

export function useResizeWidth() {
    let $useIsCollapseStore = useIsCollapseStore();
    onMounted(() => {
        window.onresize = function () {
            console.log(innerWidth)
            if (innerWidth - 100 < 500) {
                $useIsCollapseStore.changeWidth(400);
            } else {
                $useIsCollapseStore.changeWidth(innerWidth - 100);
            }
        };
    });
    onUnmounted(() => {
        window.onresize = null;
    })


}
